﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using ShanNiang.Service;
using ShanNiang.Service.Constants;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace ShanNiang.Mvvm.ViewModels
{
    /// <summary>
    /// 用户视图对象
    /// </summary>
    public partial class UserViewModel : ObservableObject
    {
        public UserViewModel()
        {
            _menuCodes = new ObservableCollection<MenuViewModel>();
            //var loginControl = MenuViewModel.Create(CommonData.MENU_LOGIN);
            //if (loginControl != null)
            //{
            //    _menuCodes.Add(loginControl);
            //}

            //IsLogin = true;

            HeadImg = "/Images/packing.png";
            RealName = "未登录";
            NickName = "昵称";
            RoleName = "装箱员";
            EnterpriseName = "中浦耐杯";
            RecentPacking = 800;
            TodayPacking = 20;
        }
        public void AddUserMenu(MenuViewModel menuViewModel)
        {
            MenuCodes.Add(menuViewModel);
        }
        /// <summary>
        /// 企业名
        /// </summary>
        [ObservableProperty]
        private string? _enterpriseName;
        /// <summary>
        /// 头像
        /// </summary>
        [ObservableProperty]
        private string? _headImg;
        /// <summary>
        /// 是否已登陆
        /// </summary>
        [ObservableProperty]
        private bool _isLogin;
        /// <summary>
        /// 拥有的菜单编码
        /// </summary>
        [ObservableProperty]
        private ObservableCollection<MenuViewModel> _menuCodes;
        /// <summary>
        /// 昵称
        /// </summary>
        [ObservableProperty]
        private string? _nickName;
        /// <summary>
        /// 真实姓名
        /// </summary>
        [ObservableProperty]
        private string? _realName;
        /// <summary>
        /// 最近装箱数
        /// </summary>
        [ObservableProperty]
        private int _recentPacking;
        /// <summary>
        /// 角色名称
        /// </summary>
        [ObservableProperty]
        private string? _roleName;
        /// <summary>
        /// 今日装箱数
        /// </summary>
        [ObservableProperty]
        private int _todayPacking;
        ///// <summary>
        ///// 刷新
        ///// </summary>
        ///// <returns></returns>
        //[RelayCommand]
        //public Task RefResh()
        //{
        //    return Task.CompletedTask;
        //}

    }
}
